import React,{useEffect} from 'react';
import Taro from '@tarojs/taro';
import {View} from '@tarojs/components';
import './CommodDetails.scss';
import CommodInfo from './CommodInfo/CommodInfo'; //商品信息组件
import {MySwiper} from './MySwiper';  //自定义轮播图
import FixedButton from "./FixedButton/FixedButton"; //固定的购买按钮
import {commodDetailsData} from './CommodDetailsData.js';

const CommodDetails:React.FC = () => {
  const router = Taro.useRouter(); //获取路由
  useEffect(() => {
      console.log(router.params.id);
    // console.log(Taro.getCurrentInstance().router!.params.id);
  },[])

  return (
    <>
      <View style='padding-bottom:50px'>
        <MySwiper img={commodDetailsData.imgs}></MySwiper>
        <CommodInfo Commod={commodDetailsData}></CommodInfo>
      </View>
      <FixedButton comId={commodDetailsData.comId}></FixedButton>
    </>
  )
}

export default CommodDetails;
